#include "EPSG/WalkManipulator.h"

#include "EPSG/Camera.h"

EPSG::WalkManipulator::WalkManipulator( EPSG::Camera* camera )
: EPSG::Manipulator( camera )
{

}

bool EPSG::WalkManipulator::apply( unsigned char key, int x, int y )
{
	if( _camera == NULL )
		return false;

	switch( key )
	{
	case 'w':			// Move forward
		_camera->translate( 0, 0, -1 );
		break;

	case 's':			// Move backward
		_camera->translate( 0, 0, 1 );
		break;

	case 'a':			// Move left
		_camera->translate( -1, 0, 0 );
		break;

	case 'd':			// Move right
		_camera->translate( 1, 0, 0 );
		break;

	case 'z':			// Move up
		_camera->translate( 0, 1, 0 );
		break;

	case 'c':			// Move down
		_camera->translate( 0, -1, 0 );
		break;

	default:
		return false;
	}

	return true;
}